
<h1 align="center">Search list starter code </h1>
Use this as a start code when you want to start creating new list with search functionality. Will speed up the process! :)
{literal}
<pre class="code">
&lt;?php
	public function list() {
		
		$post = DomFgPost::getInstance();
		$query = Item::query()-&gt;orderBy('t.name DESC');
			
		if( $_GET['delete'] && $item = Item::load( $_GET['delete'] )){
			$item-&gt;delete();
		}
		
		if( $post->doSearch ) {
			$query->where('name LIKE \'%'.addslashes($post->search).'%\'')
		}
		
		$panel = array(
			'title' =&gt; 'Items',
			'layout' =&gt; 'table',
			'layoutConfig' =&gt; array(
				'columns' =&gt; 4,
			),
			'items' =&gt; array(
				array(
					'type' =&gt; 'button',
					'title' =&gt; 'Lisa uus',
					'link' =&gt; $this-&gt;getUrl('manageItem/'),
				),
				array(
					'type' =&gt; 'textField',
					'value' =&gt; $post->search,
					'name' =&gt; 'search',
					'title' =&gt; 'Otsi',
				),
				array(
					'type' =&gt; 'button',
					'title' =&gt; 'Otsi',
					'name' =&gt; 'doSearch',
					'link' =&gt; $this-&gt;getUrl('list/'),
				),
				array(
					'type' =&gt; 'grid',
					'source' =&gt; new DomArDataSource( $query, 40 ),
					'colspan' =&gt; 4,
					'fields' =&gt; array(
						array('key' =&gt; 'name', 'title' =&gt; 'Nimi'),
						array('type' =&gt; 'gridButton', 'value' =&gt; 'Muuda', 'link' =&gt; $this-&gt;getUrl('manageItem/'), 'title' =&gt; 'Valikud','colspan' =&gt; 2),
						array('type' =&gt; 'gridButton', 'value' =&gt; 'Kustuta', 'link' =&gt; $this-&gt;getUrl('list/&amp;delete='), 'confirmMessage' => 'Are you sure?' ),
					),
				),
			),
		);
			
		$this-&gt;view-&gt;contents = DomFg::render( $panel );
	}
?&gt;
</pre>
{/literal}

